import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CommonVO, CommonForm, CommonQuery } from '@/api/device/common/types';

/**
 * 查询品牌信息列表
 * @param query
 * @returns {*}
 */

export const listCommon = (query?: CommonQuery): AxiosPromise<CommonVO[]> => {
  return request({
    url: '/device/common/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询品牌信息详细
 * @param commonId
 */
export const getCommon = (commonId: string | number): AxiosPromise<CommonVO> => {
  return request({
    url: '/device/common/' + commonId,
    method: 'get'
  });
};

/**
 * 新增品牌信息
 * @param data
 */
export const addCommon = (data: CommonForm) => {
  return request({
    url: '/device/common',
    method: 'post',
    data: data
  });
};

/**
 * 修改品牌信息
 * @param data
 */
export const updateCommon = (data: CommonForm) => {
  return request({
    url: '/device/common',
    method: 'put',
    data: data
  });
};

/**
 * 删除品牌信息
 * @param commonId
 */
export const delCommon = (commonId: string | number | Array<string | number>) => {
  return request({
    url: '/device/common/' + commonId,
    method: 'delete'
  });
};
